package Frames;

import Beans.Produto;
import DataBase.ProdutoDAO;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import javax.swing.JFormattedTextField;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.text.MaskFormatter;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRResultSetDataSource;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.view.JasperViewer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Tela_Produto.java
 *
 * Created on 04/07/2011, 15:49:18
 */
/**
 *
 * @author Jaguar
 */
public class Tela_Produto extends javax.swing.JFrame {

    /** Creates new form Tela_Produto */
    public Tela_Produto() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        Cad_Nom = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        Bt_Cad = new javax.swing.JButton();
        Bt_Cad_Limp = new javax.swing.JButton();
        Cad_Cod = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        cadPrec = new javax.swing.JTextField();
        Cad_Tip = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        Cad_Sta = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        Bt_Consu_List = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblPesquisaCons = new javax.swing.JTable();
        Tt_Consu = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        Tt_Exc = new javax.swing.JTextField();
        Bt_Exc = new javax.swing.JButton();
        jPanel10 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblPesquisaExc = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        Tt_Alt = new javax.swing.JTextField();
        jPanel12 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        Alt_Nom = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        Alt_Cod = new javax.swing.JTextField();
        Alt_Sta = new javax.swing.JComboBox();
        jLabel13 = new javax.swing.JLabel();
        altPrec = new javax.swing.JTextField();
        Alt_Tip = new javax.swing.JComboBox();
        jPanel13 = new javax.swing.JPanel();
        Bt_Alt = new javax.swing.JButton();
        Bt_Alt_Limp = new javax.swing.JButton();
        Bt_Pesq_Alt = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("tela_produto"); // NOI18N
        setUndecorated(true);

        jPanel5.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 255), 2, true));
        jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel2.setText("Nome:");
        jPanel5.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, -1, -1));
        jPanel5.add(Cad_Nom, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 30, 142, -1));

        jLabel4.setText("Tipo:");
        jPanel5.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 90, -1, -1));

        jPanel6.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 204), 1, true));

        Bt_Cad.setText("Cadastrar");
        Bt_Cad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Bt_CadActionPerformed(evt);
            }
        });

        Bt_Cad_Limp.setText("Limpar");
        Bt_Cad_Limp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Bt_Cad_LimpActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(Bt_Cad_Limp, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Bt_Cad, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(18, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Bt_Cad)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Bt_Cad_Limp)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel5.add(jPanel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 30, -1, -1));

        Cad_Cod.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Cad_CodActionPerformed(evt);
            }
        });
        jPanel5.add(Cad_Cod, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 120, 140, -1));

        jLabel1.setText("Código:");
        jPanel5.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 120, -1, -1));

        jLabel12.setText("Preço:");
        jPanel5.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 160, -1, -1));

        cadPrec.setText("000.00");
        cadPrec.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        try{
            javax.swing.text.MaskFormatter format_textField = new javax.swing.text.MaskFormatter("******");

            format_textField.setPlaceholder("000.00");
            format_textField.setValidCharacters("0123456789.");
            cadPrec  = new javax.swing.JFormattedTextField(format_textField);
        }catch (Exception e){}
        cadPrec.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                cadPrecKeyReleased(evt);
            }
        });
        jPanel5.add(cadPrec, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 160, 140, -1));

        Cad_Tip.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "prato", "guarnição", "bebida", "petisco", "sobremesa" }));
        jPanel5.add(Cad_Tip, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 90, 100, -1));

        jLabel3.setText("Status:");
        jPanel5.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        Cad_Sta.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ativado", "desativado" }));
        Cad_Sta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Cad_StaActionPerformed(evt);
            }
        });
        jPanel5.add(Cad_Sta, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 60, 100, -1));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(147, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(63, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Cadastro", jPanel1);

        jPanel7.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 204), 2, true));

        jLabel5.setText("Registro/Nome:");

        Bt_Consu_List.setText("Listar Tudo");
        Bt_Consu_List.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Bt_Consu_ListActionPerformed(evt);
            }
        });

        jPanel8.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 204), 1, true));

        tblPesquisaCons.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Registro", "Nome", "Status", "Tipo", "Código", "Preço"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tblPesquisaCons);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addContainerGap(19, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        Tt_Consu.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                Tt_ConsuKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Tt_Consu)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(Bt_Consu_List))
                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(Tt_Consu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Bt_Consu_List))
                .addGap(13, 13, 13)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(19, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(78, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(69, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Consulta", jPanel2);

        jPanel9.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 204), 2, true));

        jLabel6.setText("Registro/Nome:");

        Tt_Exc.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                Tt_ExcKeyPressed(evt);
            }
        });

        Bt_Exc.setText("Excluir");
        Bt_Exc.setEnabled(false);
        Bt_Exc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Bt_ExcActionPerformed(evt);
            }
        });

        jPanel10.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 204), 1, true));

        tblPesquisaExc.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "Registro", "Nome", "Tipo", "Código", "Preço"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        tblPesquisaExc.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblPesquisaExcMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tblPesquisaExc);

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 364, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel10, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Tt_Exc, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Bt_Exc, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(21, 21, 21))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(Tt_Exc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Bt_Exc))
                .addGap(11, 11, 11)
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(19, 19, 19))
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(61, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(68, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Exclusão", jPanel3);

        jPanel11.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 204), 2, true));

        jLabel7.setText("Nome:");

        Tt_Alt.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                Tt_AltKeyPressed(evt);
            }
        });

        jPanel12.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.blue, java.awt.Color.blue, java.awt.Color.blue, java.awt.Color.blue));

        jLabel9.setText("Nome:");

        jLabel10.setText("Status:");

        jLabel11.setText("Tipo:");

        jLabel8.setText("Código:");

        Alt_Sta.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ativado", "desativado" }));

        jLabel13.setText("Preço:");

        altPrec.setText("000.00");
        altPrec.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
        try{
            javax.swing.text.MaskFormatter format_textField = new javax.swing.text.MaskFormatter("******");

            format_textField.setPlaceholder("000.00");
            format_textField.setValidCharacters("0123456789.");
            altPrec  = new javax.swing.JFormattedTextField(format_textField);
        }catch (Exception e){}
        altPrec.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                altPrecKeyReleased(evt);
            }
        });

        Alt_Tip.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "prato", "guarnição", "bebida", "petisco", "sobremesa" }));

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel12Layout.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(altPrec, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE))
                    .addGroup(jPanel12Layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(Alt_Nom, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel12Layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Alt_Cod, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE))
                    .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel12Layout.createSequentialGroup()
                            .addComponent(jLabel11)
                            .addGap(18, 18, 18)
                            .addComponent(Alt_Tip, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel12Layout.createSequentialGroup()
                            .addComponent(jLabel10)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(Alt_Sta, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(20, 20, 20))
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(Alt_Nom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(Alt_Sta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(Alt_Tip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(Alt_Cod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(altPrec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(17, Short.MAX_VALUE))
        );

        jPanel13.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 255), 1, true));

        Bt_Alt.setText("Alterar");
        Bt_Alt.setEnabled(false);
        Bt_Alt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Bt_AltActionPerformed(evt);
            }
        });

        Bt_Alt_Limp.setText("Limpar");
        Bt_Alt_Limp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Bt_Alt_LimpActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(Bt_Alt, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Bt_Alt_Limp))
                .addContainerGap())
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Bt_Alt)
                .addGap(18, 18, 18)
                .addComponent(Bt_Alt_Limp)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        Bt_Pesq_Alt.setText("Pesquisar");
        Bt_Pesq_Alt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Bt_Pesq_AltActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(Tt_Alt))
                    .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Bt_Pesq_Alt))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(Tt_Alt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Bt_Pesq_Alt))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup()
                        .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35))))
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(67, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Alteração", jPanel4);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 497, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void Bt_CadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Bt_CadActionPerformed
        // TODO add your handling code here:
        if (!Cad_Nom.getText().equals("") && !Cad_Tip.getSelectedItem().toString().equals(" ") && !Cad_Cod.getText().equals("") && !cadPrec.getText().equals("000.00")) {
            try {
                ProdutoDAO pdao = new ProdutoDAO();
                Produto p = new Produto();

                p.setNome(Cad_Nom.getText());
                p.setStatus(Cad_Sta.getSelectedItem().toString());
                p.setTipo(Cad_Tip.getSelectedItem().toString());
                p.setCodigo(Cad_Cod.getText());
                p.setPreco(Double.parseDouble(cadPrec.getText()));

                pdao.cadastroProd(p);


            } catch (Exception ex) {
                ex.printStackTrace();
                System.out.println("Exceção cadastrar " + ex);
                System.out.println("erro no botão ");
            }
        } else {
            JOptionPane.showMessageDialog(null, "Existe Campos Vazios", "Erro no Cadastro", JOptionPane.INFORMATION_MESSAGE);
        }


    }//GEN-LAST:event_Bt_CadActionPerformed

    private void Bt_Cad_LimpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Bt_Cad_LimpActionPerformed
        // TODO add your handling code here:
        Cad_Nom.setText("");
        Cad_Sta.setSelectedItem("ativado");
        Cad_Tip.setSelectedItem(" ");
        Cad_Cod.setText("");
        cadPrec.setText("000.00");
    }//GEN-LAST:event_Bt_Cad_LimpActionPerformed

    private void Bt_Consu_ListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Bt_Consu_ListActionPerformed
        // TODO add your handling code here:
        try {
            ProdutoDAO pdao = new ProdutoDAO();
            DefaultTableModel modelo = new DefaultTableModel(0, 6);
            List<Produto> listaprod = pdao.ListarTodos();
            String[] linha = new String[6];
            Vector colunas = new Vector(6);
            if (listaprod != null) {
                //Define o nome das colunas da tabela Modelo
                colunas.add("Registro");
                colunas.add("Nome");
                colunas.add("Status");
                colunas.add("Tipo");
                colunas.add("Codigo");
                colunas.add("Preço");
                modelo.setColumnIdentifiers(colunas);

                for (Produto p : listaprod) {
                    linha[0] = (p.getRegistro() + "");
                    linha[1] = (p.getNome());
                    linha[2] = (p.getStatus());
                    linha[3] = (p.getTipo());
                    linha[4] = (p.getCodigo());
                    linha[5] = (p.getPreco() + "");
                    modelo.addRow(linha);
                }
                tblPesquisaCons.setModel(modelo);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.println(" exceção Listar empresa  " + ex);
        }


    }//GEN-LAST:event_Bt_Consu_ListActionPerformed

    private void Bt_ExcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Bt_ExcActionPerformed
        // TODO add your handling code here:
      try {
            ProdutoDAO pdao = new ProdutoDAO();
            Produto p = pdao.pesquisa(Tt_Exc.getText());
            if (!p.getNome().equals("invalido")) {
                byte resp = (byte) JOptionPane.showConfirmDialog(null, " Tem certeza que deseja Desativar o Produto " + p.getNome());
                if (resp == 0) {
                    pdao.remProd(p.getNome());
                    JOptionPane.showMessageDialog(null, "Produto Desativado \n Para Ativa-lo Faça um Novo Cadastro ");
                }
            } else {
                JOptionPane.showMessageDialog(null, "Produto nao Existente   ");


            }
        } catch (Exception ex) {
        }
        
  
        /*
        
        
        if (tblPesquisaExc != null) {
            ProdutoDAO pdao = new ProdutoDAO();
            try {

                pdao.remProd(Tt_Exc.getText());

            } catch (Exception ex) {
                //ex.printStackTrace();
                //JOptionPane.showMessageDialog(null, "Erro na Remoção do Produto" , "ERRO No Botão", JOptionPane.ERROR_MESSAGE);
                //System.out.println("");
            }
        } else {
            JOptionPane.showMessageDialog(null, "Não há Produto Informado", "Erro na Exclução", JOptionPane.INFORMATION_MESSAGE);
        }
       * 
       */
    }//GEN-LAST:event_Bt_ExcActionPerformed

    private void Bt_Pesq_AltActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Bt_Pesq_AltActionPerformed
        // TODO add your handling code here:
        if (!Tt_Alt.getText().equals("")) {

            try {
                ProdutoDAO pdao = new ProdutoDAO();
                Produto p = pdao.pesquisa(Tt_Alt.getText());
                if (!p.getNome().equals("invalido")) {
                    Alt_Nom.setText(p.getNome());
                    Alt_Sta.setSelectedItem(p.getStatus());
                    Alt_Tip.setSelectedItem(p.getTipo());
                    Alt_Cod.setText(p.getCodigo());
                    altPrec.setText(String.valueOf(p.getPreco()));
                    Bt_Alt.setEnabled(true);
                } else {
                    //JOptionPane.showMessageDialog(null, "Produto " + p.getNome() + " não Cadastrado ", "Erro na Alteração" , JOptionPane.INFORMATION_MESSAGE);
                    JOptionPane.showMessageDialog(null, "Produto " + Tt_Alt.getText() + " não Cadastrado ", "Erro na Alteração", JOptionPane.INFORMATION_MESSAGE);
                }

            } catch (Exception ex) {
                ex.printStackTrace();
            }
        } else {
            JOptionPane.showMessageDialog(null, "Não há Produto Informado", "Erro na Alteração", JOptionPane.INFORMATION_MESSAGE);
        }
    }//GEN-LAST:event_Bt_Pesq_AltActionPerformed

    private void Bt_AltActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Bt_AltActionPerformed
        // TODO add your handling code here:
        if ((!Alt_Nom.getText().equals("")) && (!Alt_Tip.getSelectedItem().toString().equals(" ")) && (!Alt_Cod.getText().equals("")) && (!altPrec.getText().equals("000.00"))) {
            try {
                ProdutoDAO pdao = new ProdutoDAO();
                Produto p = new Produto();

                p.setNome(Alt_Nom.getText());
                p.setStatus(Alt_Sta.getSelectedItem().toString());
                p.setTipo(Alt_Tip.getSelectedItem().toString());
                p.setCodigo(Alt_Cod.getText());
                p.setPreco(Double.parseDouble(altPrec.getText()));

                if (pdao.alterarProd(p, Tt_Alt.getText())) {
                    JOptionPane.showMessageDialog(null, "Produto Alterado com Sucesso ");
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                System.out.println("Exceção cadastrar " + ex);
            }
        } else {
            JOptionPane.showMessageDialog(null, "Existe Campos Vazios");
        }
    }//GEN-LAST:event_Bt_AltActionPerformed

    private void Bt_Alt_LimpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Bt_Alt_LimpActionPerformed
        // TODO add your handling code here:
        Alt_Nom.setText("");
        Alt_Sta.setSelectedItem("ativado");
        Alt_Tip.setSelectedItem(" ");
        Alt_Cod.setText("");
        altPrec.setText("000.00");
        Tt_Alt.setText("");
    }//GEN-LAST:event_Bt_Alt_LimpActionPerformed

    private void Tt_ConsuKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_Tt_ConsuKeyPressed
        // TODO add your handling code here:
        try {
            ProdutoDAO pdao = new ProdutoDAO();
            DefaultTableModel modelo = new DefaultTableModel(0, 6);
            List<Produto> lista = null;
            String[] linha = new String[6];
            Vector colunas = new Vector(6);

            lista = pdao.ListarTodos(Tt_Consu.getText());
            //Define o nome das colunas da tabela Modelo


            colunas.add("Registro");
            colunas.add("Nome");
            colunas.add("Status");
            colunas.add("Tipo");
            colunas.add("Codigo");
            colunas.add("Preço");
            modelo.setColumnIdentifiers(colunas);


            for (Produto p : lista) {

                linha[0] = (p.getRegistro() + "");
                linha[1] = (p.getNome());
                linha[2] = (p.getStatus());
                linha[3] = (p.getTipo());
                linha[4] = (p.getCodigo());
                linha[5] = (p.getPreco() + "");
                modelo.addRow(linha);


            }
            tblPesquisaCons.setModel(modelo);



        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.println("Exceção Pesquisar  " + ex);
        }
    }//GEN-LAST:event_Tt_ConsuKeyPressed

    private void Tt_ExcKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_Tt_ExcKeyPressed
        // TODO add your handling code here:
        try {
            ProdutoDAO pdao = new ProdutoDAO();
            DefaultTableModel modelo = new DefaultTableModel(0, 5);
            List<Produto> lista = null;
            String[] linha = new String[5];
            Vector colunas = new Vector(5);

            lista = pdao.ListarTodos(Tt_Exc.getText());
            //Define o nome das colunas da tabela Modelo


            colunas.add("Registro");
            colunas.add("Nome");
            //colunas.add("Status");
            colunas.add("Tipo");
            colunas.add("Codigo");
            colunas.add("Preço");
            modelo.setColumnIdentifiers(colunas);


            for (Produto p : lista) {
                linha[0] = (String.valueOf(p.getRegistro()));
                linha[1] = (p.getNome());
                //linha[2] = (p.getStatus());
                linha[2] = (p.getTipo());
                linha[3] = (p.getCodigo());
                linha[4] = (p.getPreco() + "");
                //System.out.println("Preço:" + linha[4] + "getPreco" + p.getPreco());
                modelo.addRow(linha);


            }
            tblPesquisaExc.setModel(modelo);
            if (tblPesquisaExc != null) {
                Bt_Exc.setEnabled(true);
            }

        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.println("Exceção Pesquisar  " + ex);
        }
    }//GEN-LAST:event_Tt_ExcKeyPressed
    String global;

    private void tblPesquisaExcMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblPesquisaExcMouseClicked
        // TODO add your handling code here:
        try {

            /*tblPesquisaExc.getSelectedRow();
            
            
            // habilta selecao por coluna   
            tblPesquisaExc.setColumnSelectionAllowed(true);   
            
            // desabilita a selecao por linha   
            tblPesquisaExc.setRowSelectionAllowed(false);   
            
            // escolhe quais colunas quer selecionar   
            tblPesquisaExc.setColumnSelectionInterval(tblPesquisaExc.getSelectedColumn(),tblPesquisaExc.getSelectedColumn());
             */
            //String nome = tblPesquisaExc.getValueAt(tblPesquisaExc.getSelectedRow(), 1).toString();

            //Tt_Exc.setText(tblPesquisaExc.getValueAt(tblPesquisaExc.getSelectedColumn(),tblPesquisaExc.getSelectedColumn()).toString());

            Tt_Exc.setText(tblPesquisaExc.getValueAt(tblPesquisaExc.getSelectedRow(), 1).toString());

        } catch (Exception ex) {

            ex.printStackTrace();
            System.out.println("Erro na Exclusão  " + ex);
        }
    }//GEN-LAST:event_tblPesquisaExcMouseClicked

    private void Tt_AltKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_Tt_AltKeyPressed
        // TODO add your handling code here:
   /*     try {
            ProdutoDAO pdao = new ProdutoDAO();
            List<Produto> lista = null;

            lista = pdao.ListarTodos(Tt_Alt.getText());
            //Define o nome das colunas da tabela Modelo

            for (Produto p : lista) {

                Alt_Nom.setText(p.getNome());
                Alt_Sta.setSelectedItem(p.getStatus());
                Alt_Tip.setText(p.getTipo());
                Alt_Cod.setText(p.getCodigo());
                altPrec.setText(String.valueOf(p.getPreco()));
                Bt_Alt.setEnabled(true);

            }

        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.println("Exceção Pesquisar  " + ex);
        }*/
    }//GEN-LAST:event_Tt_AltKeyPressed

    private void cadPrecKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cadPrecKeyReleased
        // TODO add your handling code here:
        JFormattedTextField txt = new JFormattedTextField();
        try {
            MaskFormatter formatter = new MaskFormatter("###.##");
            formatter.install(txt);
        } catch (Exception e) {
            // TODO: handle exception   
        }

    }//GEN-LAST:event_cadPrecKeyReleased

    private void altPrecKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_altPrecKeyReleased
        // TODO add your handling code here:
        JFormattedTextField txt = new JFormattedTextField();
        try {
            MaskFormatter formatter = new MaskFormatter("###.##");
            formatter.install(txt);
        } catch (Exception e) {
            // TODO: handle exception   
        }
    }//GEN-LAST:event_altPrecKeyReleased

    private void Cad_StaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Cad_StaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Cad_StaActionPerformed

    private void Cad_CodActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Cad_CodActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Cad_CodActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                //new Tela_Produto().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField Alt_Cod;
    private javax.swing.JTextField Alt_Nom;
    private javax.swing.JComboBox Alt_Sta;
    private javax.swing.JComboBox Alt_Tip;
    private javax.swing.JButton Bt_Alt;
    private javax.swing.JButton Bt_Alt_Limp;
    private javax.swing.JButton Bt_Cad;
    private javax.swing.JButton Bt_Cad_Limp;
    private javax.swing.JButton Bt_Consu_List;
    private javax.swing.JButton Bt_Exc;
    private javax.swing.JButton Bt_Pesq_Alt;
    private javax.swing.JTextField Cad_Cod;
    private javax.swing.JTextField Cad_Nom;
    private javax.swing.JComboBox Cad_Sta;
    private javax.swing.JComboBox Cad_Tip;
    private javax.swing.JTextField Tt_Alt;
    private javax.swing.JTextField Tt_Consu;
    private javax.swing.JTextField Tt_Exc;
    private javax.swing.JTextField altPrec;
    private javax.swing.JTextField cadPrec;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable tblPesquisaCons;
    private javax.swing.JTable tblPesquisaExc;
    // End of variables declaration//GEN-END:variables
}